package com.lqian.qian_clone;

/**
 * @author：Melody_LQ
 * @time：2022/9/1 9:46 下午
 */
public class Teacher implements Cloneable{
    private Student student;
    private int age;

    public Teacher() {
    }

    public Teacher(Student student, int age) {
        this.student = student;
        this.age = age;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public Teacher clone() throws CloneNotSupportedException {
        // Teacher -> extends Object
        // 在Teacher中，Object是父类
        // 因此这里的super ->是代表Object的
        return (Teacher) super.clone();
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "student=" + student +
                ", age=" + age +
                '}';
    }
}
